package org.dromara.oce.domain.dto;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 袋鼠IAA广告回传记录  --  返回实体
 */
@Data
public class TradeOrderIaaBackRecordExcelDTO {

	@ExcelProperty("IAA回传记录主键id")
	@ColumnWidth(20)
	private Long iaaEcpmBackId;

	@ExcelProperty("用户openid")
	@ColumnWidth(40)
	private String openId;

    @ExcelProperty("广告id")
    @ColumnWidth(20)
    private String promotionId;

    @ExcelIgnore
	private Long referralLinkId;

    @ExcelProperty("推广链接id")
    @ColumnWidth(20)
    private String referralLinkIdStr;

	@ExcelProperty("激励广告收入(元)")
	@ColumnWidth(20)
	private BigDecimal ecpmCost;

	@ExcelProperty("观看广告次数")
	@ColumnWidth(20)
	private Integer advertNum;

	@ExcelProperty("平均ecpm")
	@ColumnWidth(20)
	private BigDecimal avgEcpm;

	@ExcelProperty("最大ecpm")
	@ColumnWidth(20)
	private BigDecimal maxEcpm;

	@ExcelProperty("创建时间")
	@ColumnWidth(20)
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private LocalDateTime createTime;

	@ExcelProperty("用户买入时间")
	@ColumnWidth(20)
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private LocalDateTime userRegisterTime;

	@ExcelProperty("用户设备系统平台：andorid-安卓；ios-苹果；")
	@ColumnWidth(20)
	private String devicePlatform;

	@ExcelIgnore
	private Integer reportBackStatus;
	@ExcelProperty("上报回传结果：0-无需上报；1-上报成功；2-上报失败；")
	@ColumnWidth(20)
	private String reportBackStatusStr;

    /**
     * 是否回传标识：-1-不计算；0-否；1-是；
     */
    @ExcelIgnore
    private Integer backFlag;
    @ExcelProperty("上报回传结果：0-无需上报；1-上报成功；2-上报失败；")
    @ColumnWidth(20)
    private String backFlagStr;

	@ExcelProperty("回传时间")
	@ColumnWidth(20)
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private LocalDateTime backTime;

	@ExcelProperty("备注")
	@ColumnWidth(50)
	private String remark;

	@ExcelProperty("超时备注")
	@ColumnWidth(50)
	private String overTimeRemark;

    public void setReferralLinkIdStr(Long referralLinkId) {
        this.referralLinkIdStr = "" + referralLinkId;
    }

    public void setReportBackStatusStr(Integer reportBackStatus) {
		if (reportBackStatus == 0) {
			this.reportBackStatusStr = "无需上报";
		} else if (reportBackStatus == 1) {
			this.reportBackStatusStr = "上报成功";
		} else {
			this.reportBackStatusStr = "上报失败";
		}
	}
    public void setBackFlagStr(Integer backFlag) {
        if(backFlag != null){
            if (backFlag == 0) {
                this.backFlagStr = "不回传";
            } else if (backFlag == 1) {
                this.backFlagStr = "回传";
            }
        }
    }
}
